https://www.jianshu.com/p/6efc5cf5c569
https://www.jianshu.com/p/df92bb0cef51
https://blog.csdn.net/chevins/article/details/51488363
Running into the same issue here after upgrading from 0.44. None of the above solutions or clearing caches did the trick for me. Here's what I did to get things working again:
In the Terminal, navigate to the react-native/third-party/glog folder inside node_modules (for me, this was cd node_modules/react-native/third-party/glog-0.3.4)
Once actively in this folder, run ../../scripts/ios-configure-glog.sh
Glog is configured and the required config.h header file is created for Xcode to find
https://github.com/facebook/react-native/issues/5603
import resolveAssetSource from 'resolveAssetSource';
import image from './images/goat.png';
const {width, height} = resolveAssetSource(image);
获取动态资源图片的原始大小
Image.getSize('./myimage.png', (width, height) => {
console.log(width)
});
// IOS引用
<Image source={{uri: 图片名称'}} style={{width: 40, height: 40}} />
space-evenly
items are distributed so that the spacing between any two items (and the space to the edges) is equal.
项的分布使得任意两个项之间的间距(以及到边的空间)相等。
都是一些软件的安装程序,大型软件一般用setup,需要设置环境或参数的一般用setup,install往往是在运行的时候带某些参数,但是在某些软件里面混淆了它的概念
setup可以设置变量、环境、参数
install可以在加载的时候不设置环境、变量、参数(比如在config.sys里面加载的时候)
enforce
vt.强迫服从; 强行实施,强制执行(法律、规定等)
perform
vt.& vi.执行; 履行; 表演; 扮演vt.工作; 做; 进行; 完成vi.运行,表现; (驯兽)玩把戏
execute
vt.执行; 处死,处决; 履行; 完成
perform: 指完成困难较大、较复杂的任务。较正式用词。
execute: 指需专门技术熟练技巧去完成某种复杂的任务或表演等,也指用行动把计划或打算付诸实施或执行某项命令。
http://blog.sina.com.cn/s/blog_72605ba50102xyiz.html
https://blog.csdn.net/charlene0824/article/details/51234394
https://cnodejs.org/topic/53d68746da454a10712752f7
https://stackoverflow.com/questions/20553575/how-to-cancel-user-upload-in-formidable-node-js
http://www.cnblogs.com/yirenyang/p/4653661.html
终端字符的颜色是用转义序列进行控制,是文本模式下的系统显示功能,和具体的语言无关。
转义序列是以 ESC 开头,可以用 \033 完成相同的工作(ESC 的 ASCII 码用十进制表示就是 27, = 用八进制表示的 33)。
一)格式是:
\033[显示方式;前景色;背景色m
1)显示方式:0(默认值)、1(高亮)、22(非粗体)、4(下划线)、24(非下划线)、5(闪烁)、25(非闪烁)、7(反显)、27(非反显)
2)前景色:30(黑色)、31(红色)、32(绿色)、 33(黄色)、34(蓝色)、35(洋红)、36(青色)、37(白色)
3)背景色:40(黑色)、41(红色)、42(绿色)、 43(黄色)、44(蓝色)、45(洋红)、46(青色)、47(白色)
二)例子:
1)默认颜色:\033[0m
2)绿色:\033[1;32;40m
3)红色:\033[1;31;40m
4)printf( "\033[1;31;40m 输出红色字符 \033[0m" )
https://stackoverflow.com/questions/11404193/xcode-webview-local-html-with-images
NSURLSessionConfiguration
NSURLSessionConfiguration对象用于初始化NSURLSession对象。
展开请求级别中与NSMutableURLRequest相关的可供选择的方案,我们可以看到NSURLSessionConfiguration对于会话如何产生请求,提供了相当多的控制和灵活性。从网络访问性能,到cookie,安全性,缓存策略,自定义协议,启动事件设置,以及用于移动设备优化的几个新属性,你会发现你一直在寻找的,正是NSURLSessionConfiguration。
会话在初始化时复制它们的配置,NSURLSession有一个只读的配置属性,使得该配置对象上的变化对这个会话的政策无效。配置在初始化时被读取一次,之后都是不会变化的。
-构造方法
NSURLSessionConfiguration有三个类构造函数,这很好地说明了NSURLSession是为不同的用例而设计的。
+ "defaultSessionConfiguration"返回标准配置,这实际上与NSURLConnection的网络协议栈是一样的,具有相同的共享NSHTTPCookieStorage,共享NSURLCache和共享NSURLCredentialStorage。
+ "ephemeralSessionConfiguration"返回一个预设配置,没有持久性存储的缓存,Cookie或证书。这对于实现像"秘密浏览"功能的功能来说,是很理想的。
+ "backgroundSessionConfiguration":独特之处在于,它会创建一个后台会话。后台会话不同于常规的,普通的会话,它甚至可以在应用程序挂起,退出,崩溃的情况下运行上传和下载任务。初始化时指定的标识符,被用于向任何可能在进程外恢复后台传输的守护进程提供上下文。
想要查看更多关于后台会话的信息,可以查看WWDC Session 204: “What’s New with Multitasking”
-NSURLSessionConfiguration的属性
NSURLSessionConfiguration拥有20个属性。熟练掌握这些属性的用处,将使应用程序充分利用其网络环境。
最重要的属性:
# 替代 request 中的 forHTTPHeaderField 告诉服务器有关客户端的附加信息
"HTTPAdditionalHeaders"指定了一组默认的可以设置出站请求的数据头。这对于跨会话共享信息,如内容类型,语言,用户代理,身份认证,是很有用的。
# WebDav的身份验证
NSString *userPasswordString = [NSString stringWithFormat:@"%@:%@", user, password];
NSData * userPasswordData = [userPasswordString dataUsingEncoding:NSUTF8StringEncoding];
NSString *base64EncodedCredential = [userPasswordData base64EncodedStringWithOptions:0];
NSString *authString = [NSString stringWithFormat:@"Basic: %@", base64EncodedCredential];
# 设置客户端类型
NSString *userAgentString = @"iPhone AppleWebKit";
configuration.HTTPAdditionalHeaders = @{@"Accept": @"application/json",
@"Accept-Language": @"en",
@"Authorization": authString,
@"User-Agent": userAgentString};
"networkServiceType(网络服务类型)"对标准的网络流量,网络电话,语音,视频,以及由一个后台进程使用的流量进行了区分。大多数应用程序都不需要设置这个
"allowsCellularAccess(允许蜂窝访问)"和"discretionary(自行决定)"被用于节省通过蜂窝连接的带宽。建议在使用后台传输的时候,使用discretionary属性,而不是allowsCellularAccess属性,因为它会把WiFi和电源可用性考虑在内
"timeoutIntervalForRequest"和"timeoutIntervalForResource"指定了请求以及该资源的超时时间间隔。许多开发人员试图使用timeoutInterval去限制发送请求的总时间,但这误会了timeoutInterval的意思:报文之间的时间。timeoutIntervalForResource实际上提供了整体超时的特性,这应该只用于后台传输,而不是用户实际上可能想要等待的任何东西
"HTTPMaximumConnectionsPerHost"是 Foundation 框架中URL加载系统的一个新的配置选项。它曾经被用于NSURLConnection管理私人连接池。现在有了NSURLSession,开发者可以在需要时限制连接到特定主机的数量
"HTTPShouldUsePipelining"也出现在NSMutableURLRequest,它可以被用于开启HTTP管道,这可以显着降低请求的加载时间,但是由于没有被服务器广泛支持,默认是禁用的
"sessionSendsLaunchEvents" 是另一个新的属性,该属性指定该会话是否应该从后台启动
"connectionProxyDictionary"指定了会话连接中的代理服务器。同样地,大多数面向消费者的应用程序都不需要代理,所以基本上不需要配置这个属性
关于连接代理的更多信息可以在 CFProxySupport Reference 找到。
"Cookie Policies"
-"HTTPCookieStorage" 是被会话使用的cookie存储。默认情况下,NSHTTPCookieShorage的 + sharedHTTPCookieStorage会被使用,这与NSURLConnection是相同的
-"HTTPCookieAcceptPolicy" 决定了该会话应该接受从服务器发出的cookie的条件
-"HTTPShouldSetCookies" 指定了请求是否应该使用会话HTTPCookieStorage的cookie
"Security Policies"
URLCredentialStorage 是会话使用的证书存储。默认情况下,NSURLCredentialStorage 的+ sharedCredentialStorage 会被使用使用,这与NSURLConnection是相同的
"TLSMaximumSupportedProtocol" 和 "TLSMinimumSupportedProtocol" 确定是否支持SSLProtocol版本的会话
"Caching Policies"
URLCache 是会话使用的缓存。默认情况下,NSURLCache 的 + sharedURLCache 会被使用,这与NSURLConnection是相同的
requestCachePolicy 指定了一个请求的缓存响应应该在什么时候返回。这相当于NSURLRequest 的-cachePolicy方法
"Custom Protocols"
protocolClasses是注册NSURLProtocol类的特定会话数组
https://www.jianshu.com/p/1211cf99dfc3
https://stackoverflow.com/questions/40662007/nsurlsessiontask-suspend-does-not-work
NSURLSession的暂停和恢复支持并非真正用于实现用户级“暂停传输”功能。相反,它允许您暂时禁用回调作为某种并发控制系统的一部分。那是因为,正如您所注意到的,暂停的任务仍然可以在线路上激活; 暂停所做的就是阻止它在内部取得进展,发出回调等等。
如果您正在实施用户级暂停功能,我的建议如下:
对于下载,您应该打电话-cancelByProducingResumeData:然后继续-downloadTaskWithResumeData:。大多数服务器都支持此功能。
对于上传,事情变得更加棘手。您的服务器是否明确支持停止和恢复上传的功能?
分享和享受
-
奎因“爱斯基摩人!”
Apple Developer Relations,开发人员技术支持,核心操作系统/硬件
let myEmail = "eskimo" + "1" + "@apple.com"
https://gist.github.com/olegam/8997427
This template let's you easily implement a property getter like this:
- (UIView *)myView {
if (!_myView) {
_myView = [UIView new];
}
return _myView;
}
When you have declared a property like this:
@property(nonatomic, strong) UIView *myView;
You just change the OC Property Getter Body code template of AppCode to:
if (!$IVAR) {
#if ($RETURN_TYPE.endsWith("*"))
#set($VAR_CLASS = $RETURN_TYPE.substring(0, $RETURN_TYPE.lastIndexOf("*")).trim())
#else
#set($VAR_CLASS = $RETURN_TYPE)
#end
$IVAR = [$VAR_CLASS new];
}
return $IVAR;
This solution was given to my by Dmitry Semeniouta from Jetbrains after I asked the question on their issue tracker: http://youtrack.jetbrains.com/issue/OC-9126
It's not meant as a 'Live Template' but a 'Code Template' so you should not need to add $ and edit variables. Open Preferences->File and Code Templates->Code->OC Property Getter Body.
使用 ctrol+o 快捷键重写get方法时 才能起作用…
#if ($IVAR_IS_AVAILABLE == "true")
return $IVAR;#else
return $DEFAULT_RETURN_VALUE;#end
https://www.jianshu.com/p/7404ea214f43
https://blog.csdn.net/u014795020/article/details/72084735
https://blog.ibireme.com/2015/05/18/runloop/
创建 symbolic 断点 写 -[UIResponder touchesBegan:withEvent:] 之后 写 touch 方法 , 程序会挂起, lldb中输入 register read r14 , 或者 register read r13 , 返回一个地址 , po 这个地址 , 能找得到点击的是哪个view
https://blog.csdn.net/wangjiangang_/article/details/46301453
https://blog.csdn.net/yanchen_ing/article/details/51734664
https://blog.csdn.net/u011619283/article/details/53433243
https://www.jianshu.com/p/c58001ae3da5
http://blog.sina.com.cn/s/blog_9cd1705d0101mvk0.html
// 栅栏函数不能使用全局并发队列FileHandleViewController
// dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_queue_t queue = dispatch_queue_create("com.stone.download", DISPATCH_QUEUE_CONCURRENT);
https://blog.csdn.net/mango_ios/article/details/52686892
通过代码为xib或sb中view增加约束时,尽量避免在viewDidLoad中执行,最好放在updateViewConstraints[UIViewController]或者updateConstraints[UIView]中,记得调用[super updateViewConstraints]或者[super updateConstraints];
- (void)updateViewConstraints
{
// 在这里为你的view添加约束,请确保该view的translatesAutoresizingMaskIntoConstraints属性已设置为NO
[super updateViewConstraints];
}
如果你真的写在viewDidLoad里了,那么可能会遇到这种崩溃错误
Terminating app due to uncaught exception "NSInternalInconsistencyException"
https://www.jianshu.com/p/f2ef93a3dbb5
https://www.jianshu.com/p/76d6b8e6fca7
https://www.jianshu.com/p/494036d1bb06
在开始之前我们需要明确一点:是不是所有的block,使用self都会出现循环引用?其实不然,系统和第三方框架的block绝大部分不会出现循环引用,只有少数block以及我们自定义的block会出现循环引用。而我们只要抓住本质原因就可以了
https://www.jianshu.com/p/ca3c5a94c32b
https://www.jianshu.com/p/139f4fbe7b6b
https://www.jianshu.com/p/98ff8012362a
https://www.jianshu.com/p/b3e5444c9746
self.layer.transform = CATransform3DMakeRotation(kDegreesToRadian(des), 0, 0, 1);
[self.layer setValue:@(kDegreesToRadian(des)) forKeyPath:@"transform.rotation.z"];
KVO 好像记录了起点… 超过180度之后 逆时针了…
https://blog.csdn.net/potato512/article/details/56290428
https://blog.csdn.net/majiakun1/article/details/46426727
https://www.jianshu.com/p/d417e3038a04
将OBJC_ASSOCIATION_ASSIGN改为OBJC_ASSOCIATION_RETAIN,这样在本对象有一个强引用,这个被关联的对象也就不会释放,生命周期也和本对象相同了。我认为既然关联对象传入的都是对象,那么其实绝大多时候用的都应该是是OBJC_ASSOCIATION_RETAIN,在我们项目中传入的对象很多是NSNumber类型(包装的bool或则int)的时候都是用的OBJC_ASSOCIATION_ASSIGN,以前没暴露问题也是误打误撞错进错出。所以除了一些需要破解循环引用的场景,关联对象的内存操作修饰符建议都用OBJC_ASSOCIATION_RETAIN。
-Xss2m
-Xms2048m
-Xmx4096m
-XX:NewSize=128m
-XX:MaxNewSize=128m
-XX:ReservedCodeCacheSize=240m
-XX:+UseCompressedOops
-Dfile.encoding=UTF-8
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Xverify:none
-XX:ErrorFile=$USER_HOME/java_error_in_appcode_%p.log
-XX:HeapDumpPath=$USER_HOME/java_error_in_appcode.hprof
-javaagent:/Library/JetbrainsLicense/JetbrainsCrack-2.8-release-enc.jar
https://www.jianshu.com/p/ad8eed568ff4
https://www.cnblogs.com/spider-pei/p/7592906.html
NSUserDefaultsSizeLimitExceededNotification
当用户默认数据中存储更多数据时
NSUbiquitousUserDefaultsNoCloudAccountNotification
当设置了云默认时,但没有登录iCloud用户
NSUbiquitousUserDefaultsDidChangeAccountsNotification
当用户更改主iCloud帐户时
NSUbiquitousUserDefaultsCompletedInitialSyncNotification
发布时,默认完成下载数据,无论是第一次设备连接到一个iCloud帐户,或当用户切换他们的主要iCloud帐户
NSUserDefaultsDidChangeNotification
在当前进程中更改用户默认值时发布
https://www.jianshu.com/p/8f14cad10398
https://blog.csdn.net/czcdms/article/details/44461349
https://blog.csdn.net/caryaliu/article/details/49284185
[self mutableArrayValueForKey:NSStringFromSelector(@selector(students))];
https://blog.csdn.net/tyrant_800/article/details/49382829
https://blog.csdn.net/caryaliu/article/details/49284185
https://www.jianshu.com/p/b3a31eed945f
https://www.jianshu.com/p/3fa703e80720
static修饰全局变量
1.在全局变量前加static,全局变量就被定义成为一个全局静态变量(全局变量和静态全局变量的生命周期是一样的,都是在堆中的静态区,在整个工程执行期间内一直存在)
特点如下:
1)存储区:静态存储区没变(静态存储区在整个程序运行期间都存在);
2)作用域:全局静态变量在声明他的文件之外是不可见的。准确地讲从定义之处开始到文件结尾。非静态全局 变量的作用域是整个源程序(多个源文件可以共同使用); 而静态全局变量则限制了其作用域, 即只在定义该变量的源文件内有效, 在同一源程序的其它源文件中不能使用它。
好处:
1)不会被其他文件所访问,修改;
2)其他文件中可以使用相同名字的变量,不会发生冲突。
https://stackoverflow.com/questions/27459746/adding-space-padding-to-a-uilabel/39998301
Just use a UIButton, its already built in. Turn off all the extra button features and you have a label that you can set edge instets on.
let button = UIButton()
button.contentEdgeInsets = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5)
button.setTitle("title", for: .normal)
button.tintColor = .white // this will be the textColor
button.isUserInteractionEnabled = false
shareimprove this answer
edited Sep 11 '17 at 6:06
mxcl
18.3k117488
answered Jul 28 ‘17 at 12:09
Steve M
61454
1
Hey this is a great tip! No extensions required! :-D – Felipe Ferri Aug 16 ‘17 at 14:35
1
Setting isUserInteractionEnabled = false is handy to disable it. – mxcl Sep 11 ‘17 at 5:56
Great tip… I’d rather do this than going for an extension. – Ross Jan 14 at 15:21
第一种方法
NSString *path = [[NSBundle mainBundle] pathForResource:@"myBundle" ofType:@"bundle"];
NSBundle *bundle = [NSBundle bundleWithPath:path];
NSString *file = [bundle pathForResource:@"pic" ofType:@"png"];
UIImage *img = [UIImage imageWithContentsOfFile:file];
第二种方法
NSString *file2 = [[NSBundle mainBundle] pathForResource:@"myBundle.bundle/pic" ofType:@"png"];
UIImage *img2 = [UIImage imageWithContentsOfFile:file2];
第三种方法
UIImage *img3 = [UIImage imageNamed:@"myBundle.bundle/pic"];
https://stackoverflow.com/questions/32291105/line-spacing-for-uilabel-with-a-single-line-of-text
paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping
文本是多行时可以避免此问题。
使用fontName显式设置字体[UIFont fontWithName:@”PingFangSC-Regular” size:14],而不是使用[UIFont systemFontOfSize:14]可以避免文本是单行时的问题。
希望这对你有所帮助!
http://www.cocoachina.com/ios/20180329/22838.html
https://github.com/alibaba/VirtualView-iOS
https://github.com/forkingdog/UITableView-FDTemplateLayoutCell/issues/348
UITableView+FDTemplateLayoutCell.m文件中templateCell.contentView.translatesAutoresizingMaskIntoConstraints = NO;
改为YES
https://www.jianshu.com/p/b4ac41668ca4
https://blog.csdn.net/kingcodexl/article/details/50262729
https://www.jianshu.com/p/2a71f0806f79
https://www.cnblogs.com/yajunLi/p/6344023.html
https://blog.csdn.net/klabcxy36897/article/details/51680423
https://blog.csdn.net/jingqiu880905/article/details/50524016
xcode添加kiwi模板
https://github.com/kiwi-bdd/Kiwi.git
下载kiwi项目
进入 Xcode Templates文件夹下
bash ./install-templates.sh
之后就能使用 cmd+n来创建 kiwi模板代码了…
kiwi 简单模板代码
describe(@"SimpleString", ^{
context(@"when assigned to 'Hello world'", ^{
NSString *greeting = @"Hello world";
it(@"should exist", ^{
[[greeting shouldNot] beNil];
});
it(@"should equal to 'Hello world'", ^{
[[greeting should] equal:@"Hello world"];
});
});
});
如果执行按钮不出现 , 需要 cmd+u 一下, 让 xcode 跑一次 test
Xcode8里边 Edit Scheme… -> Run -> Arguments, 在Environment Variables里边添加 OS_ACTIVITY_MODE = disable
步骤1.
步骤2.
步骤3.
http://www.cocoachina.com/ios/20151125/14415.html
https://www.cnblogs.com/FightingLuoYin/p/4487291.html
一:为什么Xcode6没有自动创建Precompile Prefix Header
我们在写项目的时候,大部分宏定义,头文件导入都在Precompile Prefix Header文件里面。在Xcode 4, 5的模板工程中可以看到Precompile Prefix Header,但是在Xcode 6被阉割掉了,原因可以参考下面的链接:
http://stackoverflow.com/questions/24158648/why-isnt-projectname-prefix-pch-created-automatically-in-xcode-6
Xcode 6去掉Precompile Prefix Header的主要原因在于:
(1)去掉自动导入的系统框架类库的头文件,可以提高原文件的复用性,便于迁移。
(2)一个肥胖无比的Prefix Header会大大增加Build Time。
二:使用Precompile Prefix Header的好处
为了取代在Prefix Header中自动导入的框架,可以在每一个需要导入系统框架的文件中通过@import来手动导入。如果在Prefix Header中导入了,那么我们在工程的每一个文件中可以免费获得使用的权利,而无需手动在每一个.h/.m文件中导入。该文件确有其方便之处。
三:给工程中添加Precompile Prefix Header
如果一定要用到Precompile Prefix Header,可以参考Xcode 5的配置来手动设置。
(1)创建一个pch文件: Command+N,打开新建文件窗口:ios->other->PCH file
(2)给pch文件命名
在工程中增加一个pch文件,命名还是按照Xcode 5的模板比较好:工程名-Prefix.pch,例如a-Prefx.pch
(3)修改工程配置文件,将刚刚创建的PCH file的路径添加到building setting中的precompile header选项中去,注意debug和release两栏都要添加:
注意:
将Precompile Prefix Header为YES,预编译后的pch文件会被缓存起来,可以提高编译速度
修改pch文件路径按照如下格式:将building setting中的precompile header选项的路径添加“$(SRCROOT)/项目名称/pch文件名”(例如:$(SRCROOT)/自定义数字键盘/自定义数字键盘-Prefix.pch)
(4)向pch文件中添加文件
总结:Apple标都建议我们不用pch了,那么还是尽量少用吧。当然,如果一定要用,还是尽量减少pch文件中
的内容,降低工程对pch文件的依赖性,便于日后的迁移和解耦。
step 1:
mach-o type 改成 static library
step 2:
还有一处是这样的,如果你的framework里面需要添加一些分类,那么需要在Other Linker Flags 添加 -all_load(注意符号不要用中文写了,all_load它的作用是加载静态库中所有文件,all_load作用于所有的库)
step 3:
制作要分享的文件, 并选择public
step 4:
主头文件中 import 要暴露出去的文件, 没有提示…
step 5:
脚本生成 4个环境都能用的包
#xcodebuild -project hvui.xcodeproj -target FrameworkMaker_Release;rm -rf build;
productName="${PROJECT_NAME}"
target="${productName}"
tmpDir="${PROJECT_TEMP_DIR}/build"
rm -rf "${tmpDir}"#清除编译临时文件
# 有这段会报错, 暂时注释掉...可能是加载资源的
#编译bundle
# xcodebuild -target "${PROJECT_NAME}Bundle" -configuration "Release" -sdk "iphoneos" build SYMROOT="${tmpDir}" ONLY_ACTIVE_ARCH="NO" VALID_ARCHS="arm64 armv7 armv7s i386 x86_64"
function buildLibs(){
sdks=("iphonesimulator" "iphoneos")
configurations=("Debug" "Release")
for configuration in ${configurations[@]}
do
for sdk in ${sdks[@]}
do
# workspace 的时候可能使用 -target会有错误
xcodebuild -target "${target}" -configuration "${configuration}" -sdk "${sdk}" build SYMROOT="${tmpDir}" ONLY_ACTIVE_ARCH="NO" VALID_ARCHS="arm64 armv7 armv7s i386 x86_64"
done
done
}
function lipoLibs(){
#copy Release-iphoneos到 Frameworks 目录,然后 lipo -c 一份
ios_libs_dir="${SRCROOT}/../ios_libs"
frameworkDir="${ios_libs_dir}/Frameworks"
[ -d "${frameworkDir}" ] || mkdir -p "${frameworkDir}"
cp -r "${ios_libs_dir}/Release-iphoneos/${productName}.framework" "${frameworkDir}/"
#lipo -c ... -o ..
lipo -c "${ios_libs_dir}/Release-iphoneos/${productName}.framework/${productName}" "${ios_libs_dir}/Release-iphonesimulator/${productName}.framework/${productName}" -o "${frameworkDir}/${productName}.framework/${productName}"
rm -rf "${frameworkDir}/${productName}.framework/_CodeSignature"
}
function rmLibs(){
ios_libs_dir="${SRCROOT}/../ios_libs"
sdks=("iphonesimulator" "iphoneos")
configurations=("Release")
for configuration in ${configurations[@]}
do
for sdk in ${sdks[@]}
do
rm -rf "${ios_libs_dir}/${configuration}-${sdk}/${productName}.framework"
done
done
}
buildLibs
lipoLibs
#rmLibs
#cp to ios_libs
#cp -Rf "${SRCROOT}/ios_libs/Frameworks/${productName}.framework" "${SRCROOT}/../ios_libs/Frameworks/${productName}.framework"
坑
https://stackoverflow.com/questions/32687105/framework-not-found-in-xcode
有时候编译报错
去 build settings 里 搜索 Framework Search Path
碰一下
改成递归, 再改回来
自定义的framework 报文件找不到
关闭xcode 重开就好了, 草 什么玩意儿
xcrun xcodebuild \ stone@bogon
-scheme Framework_test \
-workspace Framework_test.xcworkspace \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 6 Plus,OS=9.1' \
-derivedDataPath \
build
https://www.zybuluo.com/Sweetfish/note/836091
#
# Be sure to run `pod spec lint SNLib.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see https://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#
Pod::Spec.new do |spec|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in depth.
#
spec.name = "SNLib"
spec.version = "0.0.2"
spec.summary = "A short description of SNLib."
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
spec.description = "SNLib git test"
spec.homepage = "http://EXAMPLE/SNLib"
# spec.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Licensing your code is important. See https://choosealicense.com for more info.
# CocoaPods will detect a license file if there is a named LICENSE*
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
#
spec.license = "MIT"
# spec.license = { :type => "MIT", :file => "FILE_LICENSE" }
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the authors of the library, with email addresses. Email addresses
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
# accepts just a name if you'd rather not provide an email address.
#
# Specify a social_media_url where others can refer to, for example a twitter
# profile URL.
#
spec.author = { "StonePark" => "blueone009@163.com" }
# Or just: spec.author = "StonePark"
# spec.authors = { "StonePark" => "blueone009@163.com" }
# spec.social_media_url = "https://twitter.com/StonePark"
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If this Pod runs only on iOS or OS X, then specify the platform and
# the deployment target. You can optionally include the target after the platform.
#
# spec.platform = :ios
spec.platform = :ios, "9.0"
# When using multiple platforms
# spec.ios.deployment_target = "5.0"
# spec.osx.deployment_target = "10.7"
# spec.watchos.deployment_target = "2.0"
# spec.tvos.deployment_target = "9.0"
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the location from where the source should be retrieved.
# Supports git, hg, bzr, svn and HTTP.
#
spec.source = { :git => "https://github.com/stone0117/SNLib.git", :tag => "#{spec.version}" }
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# CocoaPods is smart about how it includes source code. For source files
# giving a folder will include any swift, h, m, mm, c & cpp files.
# For header files it will include any header in the folder.
# Not including the public_header_files will make all headers public.
#
spec.source_files = "SNLib", "SNLib/**/*.{h,m}"
#spec.exclude_files = "Classes/Exclude"
# spec.public_header_files = "Classes/**/*.h"
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# A list of resources included with the Pod. These are copied into the
# target bundle with a build phase script. Anything else will be cleaned.
# You can preserve files from being cleaned, please don't preserve
# non-essential files like tests, examples and documentation.
#
# spec.resource = "icon.png"
# spec.resources = "Resources/*.png"
# spec.preserve_paths = "FilesToSave", "MoreFilesToSave"
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Link your library with frameworks, or libraries. Libraries do not include
# the lib prefix of their name.
#
# spec.framework = "SomeFramework"
# spec.frameworks = "SomeFramework", "AnotherFramework"
# spec.library = "iconv"
# spec.libraries = "iconv", "xml2"
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If your library depends on compiler flags you can set them in the xcconfig hash
# where they will only apply to your library. If you depend on other Podspecs
# you can include multiple dependencies to ensure it works.
spec.requires_arc = true
# spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
spec.dependency "Masonry", "~> 1.1.0"
spec.dependency "MBProgressHUD", "~> 1.1.0"
spec.dependency "SSZipArchive", "~> 2.1.4"
spec.dependency "SDWebImage", "~> 4.4.6"
spec.dependency "AFNetworking", "~> 3.2.1"
end
framework中引用的三方库和 , spec文件中指定的版本可能要一致, 不然可能报错…
https://segmentfault.com/a/1190000008570439
https://stackoverflow.com/questions/37864175/fastlane-there-does-not-seem-to-be-a-current-project-version-key-set-for-this-p
step1:
Build Settings 搜索 current
Current Project Version 改成当前版本号 , e.g 1.0.0
Version System 改成 Apple Generic
Build Settings 搜索 Info.plist
把 $(SRCROOT) 删掉…
终端cd到 有 .xcodeproj 目录下 , 即 工程目录下
查看当前版本
# build
agvtool what-version
# version
agvtool what-marketing-version
# build
agvtool vers
# version
agvtool mvers
自动增加版本号
agvtool next-version -all
agvtool bump -all
二者都是给build递增。version的话,没有递增的命令。-all 单元测试版本号也变
设置新版本号
# build
# 给苹果看的版本号 , 即 构建版本, test flight 版本号
agvtool new-version -all 1.0.0
# version
# 给用户看的版本号 , 即 app-store 产品上线的 能显示在历史版本记录的版本号
agvtool new-marketing-version 1.0.0
help
agvtool help